<?php require_once('../Connections/elevate954.php'); ?>
<?php require_once("../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to ADMIN_SETTINGS")){
	WA_Auth_RestrictAccess("../login_admin.php");
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
$Parambottom_ad_id_WADABOTTOM_BANNER_AD = "-1";
if (isset($_GET['bottom_ad_id'])) {
  $Parambottom_ad_id_WADABOTTOM_BANNER_AD = $_GET['bottom_ad_id'];
}
mysql_select_db($database_elevate954, $elevate954);
$query_WADABOTTOM_BANNER_AD = sprintf("SELECT bottom_ad_id, BANNER_NAME, BANNER_STATUS, PARENT_PAGE_ID, HEADLINE, SUB_HEADLINE, OFFER FROM BOTTOM_BANNER_AD WHERE bottom_ad_id = %s", GetSQLValueString($Parambottom_ad_id_WADABOTTOM_BANNER_AD, "int"));
$WADABOTTOM_BANNER_AD = mysql_query($query_WADABOTTOM_BANNER_AD, $elevate954) or die(mysql_error());
$row_WADABOTTOM_BANNER_AD = mysql_fetch_assoc($WADABOTTOM_BANNER_AD);
$totalRows_WADABOTTOM_BANNER_AD = mysql_num_rows($WADABOTTOM_BANNER_AD);
?>
<?php
mysql_select_db($database_elevate954, $elevate954);
$query_WADAMenuPARENT_PAGE_ID = "SELECT PAGE_NAME, pages_id FROM pages";
$WADAMenuPARENT_PAGE_ID = mysql_query($query_WADAMenuPARENT_PAGE_ID, $elevate954) or die(mysql_error());
$row_WADAMenuPARENT_PAGE_ID = mysql_fetch_assoc($WADAMenuPARENT_PAGE_ID);
$totalRows_WADAMenuPARENT_PAGE_ID = mysql_num_rows($WADAMenuPARENT_PAGE_ID);
?>
<?php 
// WA DataAssist Update
if (isset($_POST["Update"]) || isset($_POST["Update_x"])) // Trigger
{
  $WA_connection = $elevate954;
  $WA_table = "BOTTOM_BANNER_AD";
  $WA_redirectURL = "BOTTOM_BANNER_AD_results.php?bottom_ad_id=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."".(isset($_GET["pageNum_WADABOTTOM_BANNER_AD"])?"&pageNum_WADABOTTOM_BANNER_AD=".intval($_GET["pageNum_WADABOTTOM_BANNER_AD"]):"")  ."";
  if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  $WA_keepQueryString = false;
  $WA_indexField = "bottom_ad_id";
  $WA_fieldNamesStr = "bottom_ad_id|BANNER_NAME|BANNER_STATUS|PARENT_PAGE_ID|HEADLINE|SUB_HEADLINE|OFFER";
  $WA_fieldValuesStr = "".((isset($_POST["bottom_ad_id"]))?$_POST["bottom_ad_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["BANNER_NAME"]))?$_POST["BANNER_NAME"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["BANNER_STATUS"]))?$_POST["BANNER_STATUS"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["PARENT_PAGE_ID"]))?$_POST["PARENT_PAGE_ID"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["HEADLINE"]))?$_POST["HEADLINE"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SUB_HEADLINE"]))?$_POST["SUB_HEADLINE"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["OFFER"]))?$_POST["OFFER"]:"")  ."";
  $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
  $WA_comparisonStr = " LIKE | LIKE | LIKE | LIKE | LIKE | LIKE | LIKE ";
  $WA_fieldNames = explode("|", $WA_fieldNamesStr);
  $WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
  $WA_columns = explode("|", $WA_columnTypesStr);
  
  $WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
  $WA_where_columnTypesStr = "',none,''";
  $WA_where_comparisonStr = "=";
  $WA_where_fieldNames = explode("|", $WA_indexField);
  $WA_where_fieldValues = explode($WA_AB_Split, $WA_where_fieldValuesStr);
  $WA_where_columns = explode("|", $WA_where_columnTypesStr);
  $WA_where_comparisons = explode("|", $WA_where_comparisonStr);
  
  $WA_connectionDB = $database_elevate954;
  mysql_select_db($WA_connectionDB, $WA_connection);
  @session_start();
  $updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
  $WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues,  $WA_where_comparisons );
  $WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
  $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
  if ($WA_redirectURL != "")  {
    if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    header("Location: ".$WA_redirectURL);
  }
}
?>
<!doctype html>
<html><!-- InstanceBegin template="/Templates/ADMIN BACKEND.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="style/style.css" />
	<link rel="stylesheet" type="text/css" href="style/fluid.css" title="fluid" media="screen" />
        
	<title>Chameleon Circuit | Admin Panel from Themio</title>
        <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>

        <script type="text/javascript" src="js/excanvas.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.pie.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.stack.min.js"></script>

        <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
        <script type="text/javascript" src="js/jquery.labelify.js"></script>
        <script type="text/javascript" src="js/iphone-style-checkboxes.js"></script>
        <script type="text/javascript" src="js/jquery.ui.selectmenu.js"></script>
        <script type="text/javascript" src="js/vanadium-min.js"></script>
        <script type="text/javascript" src="js/jquery.cleditor.min.js"></script>
        <script type="text/javascript" src="js/superfish.js"></script>
        <script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="js/styleswitch.js"></script>

        <script type="text/javascript" src="js/fullcalendar.min.js"></script>
        <script type="text/javascript" src="js/jquery.uploadify.v2.1.4.min.js"></script>
        <script type="text/javascript" src="js/uploadify.js"></script>
        <script type="text/javascript" src="js/jquery.tipsy.js"></script>

        <script type="text/javascript" src="js/gcal.js"></script>
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript" src="js/jquery.pnotify.min.js"></script>
        <script type="text/javascript" src="js/examples.js"></script>

        <script type="text/javascript" src="js/sidemenu.js">// Strictly for sidebar </script>

        <!-- Toolbar for Demo Only -->
        <link rel="stylesheet" type="text/css" href="demo/toolbar.css" />
        <link rel="stylesheet" media="screen" type="text/css" href="demo/colorpicker/css/colorpicker.css" />
        <style type="text/css">
        .bodyarea_admin {
	width: 100%;
	margin: 10px
}
        </style>
        <script type="text/javascript" src="demo/colorpicker/js/colorpicker.js"></script>
        <!-- Demo js Only -->
        <script type="text/javascript" src="js/demo.js"></script>
        <!-- InstanceBeginEditable name="head" -->


<script src="../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>

<link href="../webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="../webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>


<body>
<?php include("s_header.php"); ?>
    <div class="grid_16 widget first">
        <div class="widget_title clearfix">
            <h2>&nbsp;</h2>
        </div>
        <div class="widget_body">
          <div class="widget_content">
          </div>
            <div class="bodyarea_admin" id="bodyarea_admin"><!-- InstanceBeginEditable name="BODY_AREA" -->
<div id="Update_Basic_Default_ProgressWrapper">
<form class="Basic_Default" id="Update_Basic_Default" name="Update_Basic_Default" method="post" action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)."?".$_SERVER["QUERY_STRING"]); ?>">
        <fieldset class="Basic_Default" id="Update">
          <legend class="groupHeader">Update</legend>
    <div class="lineGroup"> 
                          <div class="errorGroup">
     <span>
  <input id="bottom_ad_id" name="bottom_ad_id" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","bottom_ad_id"):"".$row_WADABOTTOM_BANNER_AD["bottom_ad_id"]."")); ?>" class="formTextfield_Medium" tabindex="1">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="BANNER_NAME" class="sublabel" > BANNER NAME:</label>
                          <div class="errorGroup">
     <span>
  <input id="BANNER_NAME" name="BANNER_NAME" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","BANNER_NAME"):"".$row_WADABOTTOM_BANNER_AD["BANNER_NAME"]."")); ?>" class="formTextfield_Medium" tabindex="2">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="BANNER_STATUS" class="sublabel" > BANNER STATUS:</label>
                          <div class="errorGroup">
     <span>
      <select class="formMenufield_Medium" name="BANNER_STATUS" id="BANNER_STATUS" tabindex="3">
        <option value="YES" <?php if (!(strcmp("YES", $row_WADABOTTOM_BANNER_AD['BANNER_STATUS']))) {echo "selected=\"selected\"";} ?>>YES</option>
        <option value="NO" <?php if (!(strcmp("NO", $row_WADABOTTOM_BANNER_AD['BANNER_STATUS']))) {echo "selected=\"selected\"";} ?>>NO</option>
      </select>
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="PARENT_PAGE_ID" class="sublabel" > PARENT_PAGE:</label>
                          <div class="errorGroup">
     <span>
      <select class="formMenufield_Medium" name="PARENT_PAGE_ID" id="PARENT_PAGE_ID" tabindex="4">
<option value="home">HOME</option>
<?php
do {  
?>
        <option value="<?php echo $row_WADAMenuPARENT_PAGE_ID['pages_id']?>"<?php if (!(strcmp($row_WADAMenuPARENT_PAGE_ID['pages_id'], (isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","PARENT_PAGE_ID"):"".$row_WADABOTTOM_BANNER_AD["PARENT_PAGE_ID"]."")))) {echo "selected=\"selected\"";} ?>><?php echo $row_WADAMenuPARENT_PAGE_ID['PAGE_NAME']?></option>
        <?php
} while ($row_WADAMenuPARENT_PAGE_ID = mysql_fetch_assoc($WADAMenuPARENT_PAGE_ID));
  $rows = mysql_num_rows($WADAMenuPARENT_PAGE_ID);
  if($rows > 0) {
      mysql_data_seek($WADAMenuPARENT_PAGE_ID, 0);
	  $row_WADAMenuPARENT_PAGE_ID = mysql_fetch_assoc($WADAMenuPARENT_PAGE_ID);
  }
?>
</select>
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="HEADLINE" class="sublabel" > HEADLINE:</label>
                          <div class="errorGroup">
     <span>
  <input id="HEADLINE" name="HEADLINE" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","HEADLINE"):"".$row_WADABOTTOM_BANNER_AD["HEADLINE"]."")); ?>" class="formTextfield_Medium" tabindex="5">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="SUB_HEADLINE" class="sublabel" > SUB HEADLINE:</label>
                          <div class="errorGroup">
     <span>
  <input id="SUB_HEADLINE" name="SUB_HEADLINE" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","SUB_HEADLINE"):"".$row_WADABOTTOM_BANNER_AD["SUB_HEADLINE"]."")); ?>" class="formTextfield_Medium" tabindex="6">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="OFFER" class="sublabel" > OFFER:</label>
                          <div class="errorGroup">
     <span>
  <textarea name="OFFER" id="OFFER" class="formTextarea_Large" rows="5" cols="100" tabindex="7"><?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","OFFER"):"".$row_WADABOTTOM_BANNER_AD["OFFER"]."")); ?></textarea>
	   </span>
                          </div>
    </div> 
        <span class="buttonFieldGroup" >
          <input type="submit" value="Update" class="formButton" id="Update" name="Update" />
        </span>
        </fieldset>
<input type="hidden" name="WADAUpdateRecordID" id="WADAUpdateRecordID" value="<?php echo((isset($_GET["invalid"])?ValidatedField("BOTTOMBANNERADupdate","WADAUpdateRecordID"):$_GET["bottom_ad_id"])); ?>" />
</form></div><div id="Update_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('Update_Basic_Default', 'Update_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
</script>
<div id="Update_Basic_Default_ProgressMessage" >
	<p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
</div>
</div>

<!-- InstanceEndEditable --></div>
        </div>
        </div>
    </div>
    <!--
<div id="dialog" title="Hello, Hello, Twisted Transistor">
	<p>Chameleon Circuit features unlimited color schemes. Try moving the color sliders on the top right corner of your screen and see how you would like YOUR theme to be!</p>
</div>
-->
<?php include("footer.php") ?>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($WADABOTTOM_BANNER_AD);
?>
<?php
mysql_free_result($WADAMenuPARENT_PAGE_ID);
?>
